class Solution {//leetcode2418——按身高排序
public:
    vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
        int n=names.size();
        vector<int> index(n);
        for(int i=0;i<n;i++) index[i]=i;

        sort(index.begin(),index.end(),[&heights](int i,int j){
            return heights[i]>heights[j];
        });

        vector<string> ret(n);
        for(int i=0;i<n;i++){
            ret[i]=names[index[i]];
        }
        return ret;
    }
};//leetcode2418——按身高排序